// User. cpp: implementation of the User class.
#include"User.h"
#include<string>
#include <fstream>
#include<iostream>
using namespace std;
User::User(string loginName,string loginPassword)
:loginName(loginName),loginPassword(loginPassword){}
void User::setUser()
{
    cout<<"Please enter login name and password:";
    cin>>loginName>>loginPassword;
}
void User::showUser()
{
    cout<<"登录名:"<<loginName<<"\t";
    cout<<"密码:"<<loginPassword<<endl;
}
void User::setLoginName(string loginName){this->loginName=loginName;}
void User::setLoginPassword(string loginPassword)
{
    this->loginPassword=loginPassword;
}
string User::getLoginName(){return loginName;}
string User::getLoginPassword(){return loginPassword;}
void User::readFromFile(fstream& in)
{
    char temp[20]="";
    in.read(temp,10);loginName=temp;
    in.read(temp,10);loginPassword=temp;

}
void User::writeToFile(fstream& out)const
{
    out.write(loginName. c_str(),10);
    out.write(loginPassword. c_str(),10);
}
